<div class="widget">
    <h3>Thông báo</h3>
</div>
<?php
   $sql = "SELECT * FROM thongbao";
   if(!isset($_GET['page']))
   {
		$_GET['page'] = 1;
   }
   $vitri = ($_GET['page'] - 1)*10;
   $trueSql = "SELECT * FROM thongbao LIMIT $vitri,10";
   $totalRecord  = mysql_query($sql);
   $n = mysql_num_rows($totalRecord);
   $tong_so_trang = floor($n/10)+1;
   $result = mysql_query($trueSql);
   if($result)
   {
        while($row = mysql_fetch_array($result,MYSQL_ASSOC))
        {
            $id       = $row['id_thongbao'];
            $tieude   = $row['tieude']; 
            $ngaydang = $row['ngaydang'];
            echo "<div id='thongbao'>
                    <a href='?id_thongbao=$id'><h4>$tieude</h4></a>
                    <h6>[ngày đăng: $ngaydang]</h6>
                  </div>";
        }
   }
   
	echo '<div id="center2">';
	echo '<ul id="pagination-digg">';
	if($_GET['page'] > 1)
	{
		echo '<li class="previous"><a href="?mod=trangchu&page='.($_GET['page'] -1).'">Back</a></li>';
	}
	for($i=1;$i<$tong_so_trang;$i++)
	{
		if($_GET['page'] == $i)
		{
			echo '<li class="active">'.$i.'</li>';
		}
		else
		{
			echo '<li><a href="?mod=trangchu&page='.$i.'">'.$i.'</a></li>'; // du?ng d?n ???
		 }
	}
	if($_GET['page'] < $tong_so_trang)
	{
		echo '<li class="next"><a href="?mod=trangchu&page='.($_GET['page']+1).'">next</a></li></ul></div>';
	}
	else
	{
		echo '<li class="next-off">next</li></ul></div>';
	}
?>

